package com.galudisu.jooq

import java.sql.DriverManager

import org.jooq.{DSLContext, SQLDialect}
import org.jooq.conf.Settings
import org.jooq.impl.DSL

/**
  * @author galudisu
  */
trait AbstractFactory extends PoolableFactory[DSLContext]{

  val url     : String
  val user    : String
  val password: String
  val driver  : String


  override def create: DSLContext = {
    Class.forName(driver)
    val conn = DriverManager.getConnection(url, user, password)
    DSL.using(conn, SQLDialect.MYSQL, new Settings().withRenderFormatted(true))

  }
}
